$(document).ready(function () {
	$('.denglu').click(function  () {
		$(this).parent().hide();
		$(this).parent().parent().children('.enroll').show()
	})
	$('.zhuce').click(function  () {
		$(this).parent().hide();
		$(this).parent().parent().children('.register').show()
	})
	$('.return').click(function  () {
		$(this).parent().hide();
		$(this).parent().parent().children('.home_page').show();
	})
	$('#validate').validate({
		rules: {
			name:{
				required:true,
				'isName': true,
				rangelength:[2,10]
			} ,
			
			email: {
			    required: true,
			    email: true
			},
			
			tel: {
				'required': true,
				'isMobile': true,	
			},
			txtPass: {
                required: true,
                minlength: 4
            },
            txtTwoPass: {
                required: true,
                minlength: 4,
                equalTo: "#txtPass"
            },
			
		},
		messages:{
			name:{
				required:'请输入姓名',
				'isName':'名字不能含有数字',
				rangelength:'名字长度不正确'
			} ,
			email:{
			    required: "请输入Email地址",
			    email: "请输入正确的email地址"
			},
			qq:{
				required: "请输入qq号",
				digits:"必须为整数",
				rangelength:"qq号个数不正确"
			},
			tel:{
				'required': "请输入联系电话",
				'isMobile': "联系电话格式不正确",
				
			},			
			txtTwoPass: {
                required: "请确认密码",
                minlength: "密码不能小于4	个字符",
                equalTo: "请再次输入相同的值"
            },
             txtPass: {
                required: "请输入密码",
                minlength: "密码不能小于4个字符"
            },
		}		
	});
	jQuery.validator.addMethod("isMobile", function(value, element) {   
    	var reg = /^1[3578]\d{9}$/;
    	return this.optional(element) || (reg.test(value));
	}, "手机格式不正确");
	
	jQuery.validator.addMethod("isName", function(value, element) {   
    	var reg = /(.+)?\d(.+)?/;
    	return this.optional(element) || (! reg.test(value));
	}, "姓名不能包含数字");
})